{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys\n",
    "import pickle\n",
    "import pandas as pd\n",
    "import polars as pl\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.dates as mdates\n",
    "import os\n",
    "import datetime as dt\n",
    "\n",
    "sys.path.append(\"../\")\n",
    "#import sql_tools\n",
    "\n",
    "pd.set_option('display.max_columns', 500)\n",
    "pd.set_option('display.max_rows', 1000)\n",
    "\n",
    "pl.Config.set_tbl_rows(1000)  # Adjust the number to match or exceed your row count\n",
    "pl.Config.set_tbl_cols(500)  # Adjust the number to match or exceed your column count\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# CHANGE\n",
    "# Paths\n",
    "path_data = '../data/' # aggregate data (included in this package)\n",
    "path_charts = '' # charts"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### FIGURE 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Open data\n",
    "df_weekly = pd.read_csv(path_data + \"weekly_tech_indexedto2019.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# DIGITAL JOBS IN TECH AND NON-TECH FIRMS\n",
    "\n",
    "tempn=df_weekly[df_weekly['date_first_visible']>='2020-01-01']\n",
    "plt.plot(tempn['date_first_visible'], tempn['digi_tech_2019'], label = 'Tech firms', color = 'k')\n",
    "plt.plot(tempn['date_first_visible'], tempn['digi_no_tech_2019'], label = 'Non-tech firms', color = 'r',linestyle = \"--\")\n",
    "\n",
    "ax = plt.gca()\n",
    "ax.xaxis.set_major_locator(mdates.YearLocator())\n",
    "ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))\n",
    "#plt.xticks(rotation=90)\n",
    "\n",
    "ax.set_ylabel('Index, 2019=100', rotation=90,loc='center', fontsize=14)\n",
    "ax.set_ylim([20, 300])\n",
    "ax.legend(loc=0, frameon=True, framealpha=1, fontsize=14)\n",
    "\n",
    "ax.tick_params(axis='x', labelsize=14)  # Font size for x-axis tick labels (years)\n",
    "ax.tick_params(axis='y', labelsize=14)  # Font size for y-axis tick labels (values)\n",
    "\n",
    "plt.savefig(path_charts+'digital_by_tech_ind.eps',bbox_inches='tight')\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# NON-DIGITAL JOBS IN TECH AND NON-TECH FIRMS\n",
    "tempn=df_weekly[df_weekly['date_first_visible']>='2020-01-01']\n",
    "plt.plot(tempn['date_first_visible'], tempn['no_digi_tech_2019'], label = 'Tech firms', color = 'k')\n",
    "plt.plot(tempn['date_first_visible'], tempn['no_digi_no_tech_2019'], label = 'Non-tech firms', color = 'r',linestyle = \"--\")\n",
    "\n",
    "ax = plt.gca()\n",
    "ax.xaxis.set_major_locator(mdates.YearLocator())\n",
    "ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y'))\n",
    "#plt.xticks(rotation=90)\n",
    "\n",
    "ax.set_ylabel('Index, 2019=100', rotation=90,loc='center', fontsize=14)\n",
    "ax.set_ylim([20, 300])\n",
    "ax.legend(loc=0, frameon=True, framealpha=1, fontsize=14)\n",
    "\n",
    "ax.tick_params(axis='x', labelsize=14)  # Font size for x-axis tick labels (years)\n",
    "ax.tick_params(axis='y', labelsize=14)  # Font size for y-axis tick labels (values)\n",
    "\n",
    "plt.savefig(path_charts+'non-digital_by_tech_ind.eps',bbox_inches='tight')\n",
    "plt.show()\n",
    "plt.close()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10.11 ('env_indeed2')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  },
  "vscode": {
   "interpreter": {
    "hash": "7120590dfa35e6512fb14e5e70b67446c3e78c7a5c027e908dbb14d6a3f8a0eb"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
